class Solution
{
public:
    vector<int> divisibilityArray(string word, int m)
    {
        long long mod = 0;
        int n = word.size();
        vector<int> result(n, 0);
        for (int i = 0; i < n; ++i)
        {
            int digit = word[i] - '0';
            mod = (mod * 10 + digit) % m;
            if (mod == 0)
            {
                result[i] = 1;
            }
        }
        return result;
    }
};